Properly create a menu proxy from a GIcon. Patch by Christian Persch
authorMatthias Clasen <matthiasc@src.gnome.org>
Sun, 11 Jan 2009 05:44:18 +0000 (05:44 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Sun, 11 Jan 2009 05:44:18 +0000 (05:44 +0000)
       * gtk/gtktoolbutton.c: Properly create a menu proxy from a GIcon.
        Patch by Christian Persch

        * tests/testtoolbar.c: Add an example with a GIcon

svn path=/trunk/; revision=22084

ChangeLog
gtk/gtktoolbutton.c
tests/testtoolbar.c

index 1a5bb0e5f34822ef983bda175146041481c3a72a..dd3ebc05cf7100f6fdbe25deaf3cc9dfbc108942 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2009-01-11  Matthias Clasen  <mclasen@redhat.com>
+
+       Bug 567024 – gtktoolbutton doesn't create right proxy menu item 
+       image with GIcon
+
+       * gtk/gtktoolbutton.c: Properly create a menu proxy from a GIcon.
+       Patch by Christian Persch
+
+       * tests/testtoolbar.c: Add an example with a GIcon
+
 2009-01-09  Christian Dywan  <christian@imendio.com>
 
        Fail in gdk_window_new if _gdk_window_new failed
index 60cdf4091d5d00f2d2fc0486d85d2aaf6dc13c39..65b3c1aaa98719d576c84f0c83bf4eb3bf7e2b2a 100644 (file)
@@ -579,6 +579,12 @@ clone_image_menu_size (GtkImage *image, GtkSettings *settings)
       gtk_image_get_icon_set (image, &icon_set, NULL);
       return gtk_image_new_from_icon_set (icon_set, GTK_ICON_SIZE_MENU);
     }
+  else if (storage_type == GTK_IMAGE_GICON)
+    {
+      GIcon *icon;
+      gtk_image_get_gicon (image, &icon, NULL);
+      return gtk_image_new_from_gicon (icon, GTK_ICON_SIZE_MENU);
+    }
   else if (storage_type == GTK_IMAGE_PIXBUF)
     {
       gint width, height;
index 22f776199b64ea892082ac6b4d9527ede3f9807b..42e5feaea58c39b29b175836bb78403867500f96 100644 (file)
@@ -511,6 +511,7 @@ main (gint argc, gchar **argv)
   GtkWidget *menuitem;
   GtkWidget *button;
   GtkWidget *label;
+  GIcon *gicon;
   GSList *group;
   
   gtk_init (&argc, &argv);
@@ -706,7 +707,14 @@ main (gint argc, gchar **argv)
   add_item_to_list (store, item, "Apple");
   gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
   gtk_tool_button_set_use_underline (GTK_TOOL_BUTTON (item), TRUE);
-  
+
+  gicon = g_content_type_get_icon ("video/ogg");
+  image = gtk_image_new_from_gicon (gicon, GTK_ICON_SIZE_LARGE_TOOLBAR);
+  g_object_unref (gicon);
+  item = gtk_tool_button_new (image, "Video");
+  add_item_to_list (store, item, "Video");
+  gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
+
   hbox = gtk_hbox_new (FALSE, 5);
   gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
   gtk_table_attach (GTK_TABLE (table), hbox,